import request from '@/utils/request'

/**
 * 获取组织架构
 */
export const getDepartments = () => {
  return request({
    url: '/company/department'
  })
}
/**
 * 删除部门
 * @param {id} 部门 id
 */
export const delDepartments = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

/**
 * 添加部门
 */
export const addDepartments = (data) => {
  return request({
    method: 'POST',
    url: '/company/department',
    data
  })
}

/**
 * 获取部门负责人数据
 */
export const getManagerList = () => {
  return request({
    url: '/sys/user/simple'
  })
}
/**
 * 编辑部门
 * @param {id} id
 */
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 编辑部门
 * @param {*} data
 */
export const updateDepartments = (data) => {
  return request({
    method: 'PUT',
    url: `/company/department/${data.id}`,
    data
  })
}
